Today you will learn how to code a game!

  • Click Run and play the example game.
  • Press the right arrow and left arrow keys to move your sprite side to side to catch the info.

Your phone number, address, and birthdate are examples of information that you should not post online.

Keep your data from falling off the bottom of the into the hands of the wrong people!

To navigate the page using the TAB key, first press ESC to exit the code editor.

stage.set_background("schoolhallway") sprite = codesters.Sprite("person8") stage.set_gravity(4) stage.disable_floor() sprite.set_gravity_off() sprite.go_to(0, -220) score = 0 score_board = codesters.Display(score) my_info = ["cellphone", "address", "birthdate"] def left_key(): sprite.move_left(20) # add other actions... stage.event_key("left", left_key) def right_key(): sprite.move_right(20) # add other actions... stage.event_key("right", right_key) def interval(): x = random.randint(-230, 230) info_img = random.choice(my_info) # sprite = codesters.Sprite("image", x, y) info = codesters.Sprite(info_img, x, 275) # add any other actions... stage.event_interval(interval, 3) def collision(sprite, hit_sprite): # add any other actions... global score stage.remove_sprite(hit_sprite) score += 1 score_board.update(score) sprite.event_collision(collision)
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)